﻿<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-21475122-5']);
      _gaq.push(['_setCustomVar', 1, 'Repo', 'lepture/editor']);
      _gaq.push(['_trackPageview']);
      _gaq.push(['_trackPageLoadTime']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        if (location.port) {
          return;
        }
        ga.src = 'ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    </script>
<script type="text/javascript" src="marked.js"></script>
<script type="text/javascript" src="editor.js"></script>
<link rel="stylesheet" href="editor.css"/>
<title>Editor</title>
<style type="text/css">body{padding:0;margin:0;background-color:#f9f9f7;}.editor-wrapper{max-width:680px;padding:10px;margin:60px auto;}</style>
</head>
<body>
<div class="editor-wrapper">
    <textarea id="editor" placeholder="Content here ...."></textarea>
</div>
<script type="text/javascript" src="zepto.js"></script>
<script type="text/javascript">
//    (function($) {
//      $('#editor').load('markdown.md',
//        function(data) {
//          var editor = new Editor();
//          editor.render();
//            var text = editor.codemirror.getValue();
//            var textParse = editor.constructor.markdown(text);
//            console.log(textParse);
//        }
//      );
//    })(Zepto);
function Editor(input, preview) {
    this.update = function () {
        preview.innerHTML = markdown.toHTML(input.value);
    };
    input.editor = this;
    this.update();
}
var $ = function (id) { return document.getElementById(id); };
new Editor($("text-input"), $("preview"));
</script>
</body>
</html>
